<cfif IsDefined('prodid')>
	<CFQUERY NAME="checkprod" DATASOURCE="#dsn#">
		select *
		from tblproducts
		where prodid = '#prodid#'
		or ProductName like '%#prodid#%'
	</CFQUERY>
	<cfif checkprod.RecordCount IS 1>
		<cflocation url="edit_item.cfm?prodid=#checkprod.prodid#" addtoken="false">
		<cfabort>
	<cfelseif checkprod.RecordCount IS 0>
		<cflocation url="editlist.cfm?m=No match was found." addtoken="false">
		<cfabort>
	<cfelse>
		<cfset show_filter = 1>
	</cfif>
</cfif>
<cfparam name="recordstart" default="1">
<cfparam name="recordsperpage" default="10">
<cfoutput>
<CFQUERY NAME="getprod" DATASOURCE="#dsn#">
select *
from tblproducts
<cfif IsDefined('show_filter')>
		where prodid = '#prodid#'
		or ProductName like '%#prodid#%'
</cfif>
ORDER BY Category
</CFQUERY>
<CFQUERY NAME="getdroplist" DATASOURCE="#dsn#">
	select Productname
	from tblproducts
</cfquery>
<cfset autosuggest = "">
<cfloop query="getdroplist">
	<cfset autosuggest = ListAppend(autosuggest,productname,"|")>
</cfloop>
<CFQUERY NAME="getdroplist" DATASOURCE="#dsn#">
	select ProdID
	from tblproducts
</cfquery>
<cfloop query="getdroplist">
	<cfset autosuggest = ListAppend(autosuggest,ProdID,"|")>
</cfloop>

<cfset autosuggest = ListSort(autosuggest,"textnocase","asc","|")>
<cfset autosuggest = ReplaceNoCase(autosuggest,"|",",","All")>
</cfoutput>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {font-size: 18px}
.style5 {
	color: #666666;
	font-size: 10px;
}
.style12 {color: #666666; font-weight: bold; font-size: 12px; }
.style13 {font-size: 12px}
-->
</style></head>

<BODY OnLoad="document.form1.prodid.focus();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="213" border="0" align="left" cellpadding="2" cellspacing="0">
      <tr>
        <td width="31" height="55" bgcolor="#eeeeee"><img src="../images/edit.png" width="55" height="51" /></td>
        <td width="182" height="55" bgcolor="#eeeeee">Edit Items (<cfoutput>#getprod.recordCount# items</cfoutput>)</td>
      </tr>
    </table>
    <br /></td>
  </tr>
  <tr>
    <td><hr size="1" noshade="noshade" /></td>
  </tr>
  <tr>
    <td height="232" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="4">
      <tr>
        <td align="left" valign="top"><cfoutput>
              <span class="style1">UPC / PRODUCT ID:</span> 
			<cfform name="form1" id="form1" method="post" action="editlist.cfm">
              <label><cfinput type="text" name="prodid" class="style1" size="35" autosuggest="#autosuggest#"></label>
				<input name="button" type="submit" class="style1" id="button" value="Go" />
			<cfif recordstart GT 1>
				<a href="editlist.cfm?recordstart=1">Previous</a> 
			</cfif>
			<cfif DecrementValue(evaluate(recordstart+recordsperpage)) LT getprod.RecordCount>
				<a href="editlist.cfm?recordstart=#evaluate(recordstart+recordsperpage)#"> Next </a>
			</cfif>
			<cfif IsDefined('show_filter')><a href="editlist.cfm">Show All</a></cfif>
	        </cfform>
		</cfoutput>
        </td>
        </tr>
      <tr>
        <td height="45" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="3">
          <tr>
            <td><span class="style12">UPC</span></td>
            <td><span class="style12">Product Name</span></td>
            <td><span class="style12">Cost</span></td>
            <td align="left"><span class="style12">Price</span></td>
            <td align="center"><span class="style12">Tax</span></td>
            <td align="center"><span class="style12">QTY</span></td>
            <td align="center"><span class="style13"></span></td>
          </tr>
         <cfoutput query="getprod" startrow="#recordstart#" maxrows="#recordsperpage#">
			<tr bgcolor="###iif(currentrow MOD 2,DE('f1f8fc'),DE('ffffff'))#" style="text-transform:uppercase">
            <td height="35"><span class="style5">#ProdID#</span></td>
            <td height="35" class="style5">#ProductName#</td>
            <td height="35" class="style5">#LSCURRENCYFORMAT(Cost)#</td>
            <td height="35" align="left" class="style5">#LSCURRENCYFORMAT(Price)#</td>
            <td height="35" align="center" class="style5">#Tax#</td>
            <td height="35" align="center" class="style5">#Qty#</td>
            <td align="center" class="style5"><a href="edit_item.cfm?ProdID=#ProdID#"><img src="../images/edit.gif" alt="Edit" width="30" height="28" border="0" /></a></td>
         </tr></cfoutput>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
